package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.util.ProdCateUtil;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.data.CustAttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author liaojing
 * NB物联网水务抄表服务-超声波--型号属性联动
 * @create 2022-01-19-10:01
 */
public class WaterMeterReadingServiceAttrHandler extends AbstractAttrHandler<KiteInst, CustAttrData> {

    @Autowired
    private IOperateSceneInstService operateSceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, CustAttrData data) {
        super.after(attr, inst, data);
        //产品变更 业务信息 置灰
        if(KiteStringUtils.isEqual(data.getServiceOfferId(), "2826")){
            if(KiteStringUtils.equalsAny(inst.getSpecId(),"63249659")){
                //型号
                inst.getAttrMap().get("200002772").setIsEdit(KeyConsts.IFTRUE_F);
                //销售价
                inst.getAttrMap().get("200004107").setIsEdit(KeyConsts.IFTRUE_F);
                operateSceneInstService
                    .setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr);
            }
        }
    }

}
